package com.tools.generator.service.impl;

import com.tools.common.utils.DateUtils;
import com.tools.generator.entity.ProjectModifyEntity;
import com.tools.generator.mapper.ProjectModifyMapper;
import com.tools.generator.service.ProjectModifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

@Service
public class ProjectModifyServiceImpl implements ProjectModifyService {

    @Autowired
    private ProjectModifyMapper projectModifyMapper;

    @Override
    public List<ProjectModifyEntity> page(ProjectModifyEntity query) {
        return projectModifyMapper.selectGenProjectModifyList(query);
    }

    @Override
    public byte[] download(ProjectModifyEntity project) throws IOException {
        return new byte[0];
    }

    @Override
    public int save(ProjectModifyEntity entity) {
//        entity.setExclusions(ProjectUtils.EXCLUSIONS);
//        entity.setModifySuffix(ProjectUtils.MODIFY_SUFFIX);
        entity.setCreateTime(DateUtils.getNowDateTimeString());
        return projectModifyMapper.insertGenProjectModify(entity);
    }

    @Override
    public ProjectModifyEntity getById(Long id) {
        return projectModifyMapper.selectGenProjectModifyById(id);
    }

    @Override
    public void updateById(ProjectModifyEntity entity) {
        projectModifyMapper.updateGenProjectModify(entity);
    }

    @Override
    public void removeByIds(List<Long> idList) {
        projectModifyMapper.deleteGenProjectModifyByIds(idList);
    }
}
